package ps.server;


public abstract class DelayedLookup implements Runnable {
    
    private boolean running = true;
    private int delay = 1000;
    
    public DelayedLookup(int delay) {
        this.delay = delay;
    }
    
    @Override
    public void run() {
        try {
            while (running) {
                Thread.sleep(delay);
                lookupNow();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    
    protected abstract void lookupNow();
    
    public void stop() {
        running = false;
    }
    
}
